package tencent2;


import java.util.Arrays;
import java.util.Scanner;

public class Main4 {
    public static void main(String[] args) {
        int n, t;
        Car[] p;
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        t = scanner.nextInt();
        p = new Car[n];
        boolean flag=false;
        for (int i = 0; i < n; ++i) {
            int place = scanner.nextInt();
            p[i] = new Car(i, place);
        }
        for (int i = 0; i < n; ++i) {
            p[i].v = scanner.nextInt();
            if(i!=0&&p[i].v!=p[0].v){
                flag=true;
            }
        }
        if(!flag){
            System.out.println(0);
            return;
        }
        Arrays.sort(p);
        for (int i = 0; i < n; ++i) {
            if (i == 0) {
                p[p[i].no].rank = 1;
            } else if (p[p[i].no].place == p[p[i - 1].no].place) {
                p[p[i].no].rank = p[p[i - 1].no].rank;
            } else {
                p[p[i].no].rank = p[p[i - 1].no].rank + 1;
            }
            p[p[i].no].place += p[p[i].no].v * t;
        }

        for(int i=0;i<n;++i) {

            System.out.print(p[i].no + ":" + p[i].rank+":"+p[i].place+"  ");
        }
        System.out.println();

        Arrays.sort(p);
        for (int i = 0; i < n; ++i) {
            if (i == 0) {
                p[p[i].no].newRank = 1;
            } else if (p[p[i].no].place == p[p[i - 1].no].place) {
                p[p[i].no].newRank = p[p[i - 1].no].newRank;
            } else {
                p[p[i].no].newRank = p[p[i - 1].no].newRank + 1;
            }
        }

        for(int i=0;i<n;++i){
            System.out.print(p[i].no+":"+p[i].newRank+":"+p[i].place+"  ");
        }
        System.out.println();


        int ans = 0;
        for (int i = 0; i < n; ++i) {
            if (p[i].newRank > p[i].rank) {
                ans++;
            }
        }
        System.out.println(ans);

    }
}

class Car implements Comparable<Car> {

    int no;
    int place;
    int rank;
    int newRank;
    int v;

    public Car(int no, int place) {
        this.no = no;
        this.place = place;
    }

    @Override
    public int compareTo( Car o) {
        return (this.place - o.place);
    }
}